package com.xing.game.bean;

import com.xing.game.bean.api.BeanProcessor;

public class DefaultBeanProcessorChain extends AbstractBeanProcessorChain{
	private Class<?> matchClass;

	public DefaultBeanProcessorChain() {}

	public DefaultBeanProcessorChain(Class<?> matchType) {
		this.matchClass = matchType;
	}

	public boolean isMatch(Class<?> beanClass){
		if(matchClass == null){
			return true;
		}

		return matchClass.isAssignableFrom(beanClass);
	}
	@Override
	public Object clone() throws CloneNotSupportedException {
		return super.clone();
	}
	
	public void addLastBeanProcessor(BeanProcessor beanProcessor){
		beanProcessors.add(beanProcessor);
	}
	
	public void addFirstBeanProcessor(BeanProcessor beanProcessor){
		beanProcessors.add(0, beanProcessor);
	}
}
